package com.goktech.olala.core.service.impl;

import com.goktech.olala.core.service.IGoodIndexService;
import com.goktech.olala.server.dao.goods.ActivityMapper;
import com.goktech.olala.server.dao.goods.AdvertMapper;
import com.goktech.olala.server.dao.goods.ArticleMapper;
import com.goktech.olala.server.pojo.goods.Activity;
import com.goktech.olala.server.pojo.goods.Advert;
import com.goktech.olala.server.pojo.goods.Article;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author sanming
 * @Classname GoodIndexServiceImp
 * @Description TODO
 * @Date 2020/12/7 19:08
 * @Created by sanming
 */

@Service
public class GoodIndexServiceImp implements IGoodIndexService {

    @Autowired
    ArticleMapper articleMapper;

    @Autowired
    ActivityMapper activityMapper;

    @Autowired
    AdvertMapper advertMapper;

    /**
     * 查询首页所有热门头条
     * @return 返回查询到的所有Article的List
     */
    @Override
    public List<Article> selectArticle() {
        List<Article> articles = articleMapper.selectAll();
        return articles;
    }

    /**
     * 查询首页所有热门活动
     * @return 返回查询到的所有活动的List
     */
    @Override
    public List<Activity> selectActivity() {
        List<Activity> activities = activityMapper.selectAll();
        return activities;
    }

    /**
     * 查询首页轮播图
     * @return 返回查询到的所有轮播图的List
     */
    @Override
    public List<Advert> selectAdvert() {
        List<Advert> adverts = advertMapper.selectAll();
        return adverts;
    }
}
